package cn.wizzer.app.web.commons.ext.websocket.action.msg.group;

import cn.wizzer.app.user.modules.services.GroupMemberService;
import cn.wizzer.app.web.commons.ext.websocket.filter.TokenFilter;
import cn.wizzer.app.web.commons.ext.websocket.main.action.BaseNettyAction;
import cn.wizzer.app.web.commons.ext.websocket.main.action.NettyAction;
import cn.wizzer.framework.base.Result;
import cn.wizzer.framework.util.param.Param;
import cn.wizzer.framework.util.param.Param4Map;
import com.alibaba.dubbo.config.annotation.Reference;
import com.alibaba.fastjson.JSONObject;
import io.netty.channel.Channel;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;

/**
 * @author zl
 * @date 2020/6/5 16:43
 */
@IocBean
@NettyAction(uri = "/group/member/list", filters = {TokenFilter.class})
public class GroupMemberAction extends BaseNettyAction {

    @Inject
    @Reference
    private GroupMemberService groupMemberService;

    @Override
    public Result action(Channel income, @Param4Map(fields = {@Param(name = "groupId", required = true)}) JSONObject params) {
        return Result.success().addData(groupMemberService.list(params.getString("appid"), params.getString("groupId")));
    }
}
